package com.dong.bridgeMode.channel;

import com.dong.bridgeMode.mode.IPayMode;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import java.math.BigDecimal;

/**
 * @author DongJiaQi
 * @create 2023/1/3 14:29
 * @Description: 微信支付
 */
@Data
@NoArgsConstructor
@Slf4j
public class WxPay extends Pay {
    public WxPay(IPayMode payMode) {
        super(payMode);
    }
    @Override
    public String transfer(String uId, String tradeId, BigDecimal amount) {
        log.info("模拟微信渠道⽀付划账开始。uId：{} tradeId：{} amount：{}", uId, tradeId, amount);
        boolean security = payMode.security(uId);
        log.info("模拟微信渠道⽀付⻛控校验。uId：{} tradeId：{} security：{}", uId, tradeId, security);
        if (!security) {
            log.info("模拟微信渠道⽀付划账拦截。uId：{} tradeId：{} amount：{}", uId, tradeId, amount);
            return "0001";
        }
        log.info("模拟微信渠道⽀付划账成功。uId：{} tradeId：{} amount：{}",  uId, tradeId, amount);
        return "0000";
    }

}
